/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package se.hed.creature;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author fredrik
 */
public class TypeCounter implements Map {
    Map<String, Integer> result = new HashMap<String, Integer>();

    public void add(String type, Integer nbr) {
        if (result.containsKey(type)) {
            result.put(type, nbr + result.get(type));
        }
        else {
            result.put(type, nbr);
        }
    }

    public int size() {
        return result.size();
    }

    public boolean isEmpty() {
        return result.isEmpty();
    }

    public boolean containsKey(Object key) {
        return result.containsKey(key);
    }

    public boolean containsValue(Object value) {
        return result.containsValue(value);
    }

    public Object get(Object key) {
        return result.get(key);
    }

    public Object put(Object key, Object value) {
        return result.put((String)key, (Integer)value);
    }

    public Object remove(Object key) {
        return result.remove(key);
    }

    public void putAll(Map m) {
        result.putAll(m);
    }

    public void clear() {
        result.clear();
    }

    public Set keySet() {
        return result.keySet();
    }

    public Collection values() {
        return result.values();
    }

    public Set entrySet() {
        return result.entrySet();
    }

    public String toString() {
        return result.toString();
    }
}
